﻿using IHISCETeim.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace IHISCETeim.BLL
{
    public enum VIPCardTypeEnum
    {
        金卡,
        白金
    }
    public class VIPCustomerHelper
    {

        /// <summary>
        /// 返回VIP卡的有效期，如果当前日期不在有效期内，则不能获取积分.
        /// </summary>
        /// <param name="CustomerId"></param>
        /// <returns></returns>
        public static bool GetValid(int CustomerId)
        {
            return GetValid(VIPCustomerController.GetList(CustomerId));
        }
        /// <summary>
        /// 返回VIP卡的有效期，如果当前日期不在有效期内，则不能获取积分.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public static bool GetValid(VIPCustomerInfo obj)
        {
            return (DateTime.Now >= obj.ValidFrom && DateTime.Now <= obj.ValidTo);
        }
        /// <summary>
        /// 获取折扣
        /// </summary>
        /// <param name="VIPCardType"></param>
        /// <returns></returns>
        public static double GetDiscByVIPCardType(string VIPCardType)
        {
            VIPCardTypeEnum mytype = (VIPCardTypeEnum)Enum.Parse(typeof(VIPCardTypeEnum), VIPCardType);
            switch (mytype)
            { 
                case VIPCardTypeEnum.金卡:
                    return 0.9;
                    break;
                case VIPCardTypeEnum.白金:
                    return 0.8;
                    break;
            }
            return 1;
        }
        /// <summary>
        /// vIP会员购机及购买IHI纯正部件10元可积1分
        /// </summary>
        /// <param name="VIPCardType"></param>
        /// <returns></returns>
        public static double GetMoenyToPoint(string VIPCardType)
        {
            return 0.1;
        }
        /// <summary>
        /// 10积分可兑换1元工时/配件费抵用卷
        /// </summary>
        /// <param name="VIPCardType"></param>
        /// <returns></returns>
        public static double GetPointToMoeny(string VIPCardType)
        {
            return 10;
        }
    }
}
